set(FELOWRIA_DIR 								${CMAKE_CURRENT_SOURCE_DIR})

set(FELOWRIA_BASE_DIR							Base)
set(FELOWRIA_NETWORK_DIR						Network)
set(FELOWRIA_THREAD_DIR							Thread)
set(FELOWRIA_LOG_DIR							Log)
set(FELOWRIA_GAME_DIR							Game)
set(FELOWRIA_LUA_DIR							Lualib)

include_directories(${INCLUDE_DIR}/Felowria)

if(${UNIX})
SET(LIBFELOWRIA			Felowria)
else(${UNIX})
SET(LIBFELOWRIA			libFelowria)
endif(${UNIX})

add_library(${LIBFELOWRIA} 	SHARED		${FELOWRIA_BASE_DIR}/DateTime.cpp

										${FELOWRIA_NETWORK_DIR}/Socket.cpp
										${FELOWRIA_NETWORK_DIR}/SocketBuffer.cpp 
										${FELOWRIA_NETWORK_DIR}/Acceptor.cpp
										${FELOWRIA_NETWORK_DIR}/SocketManager.cpp
										${FELOWRIA_NETWORK_DIR}/SocketThread.cpp
										
										${FELOWRIA_THREAD_DIR}/Thread.cpp
										${FELOWRIA_THREAD_DIR}/ThreadMutex.cpp

										${FELOWRIA_LOG_DIR}/Log.cpp

										${FELOWRIA_GAME_DIR}/WorkThread.cpp

										${FELOWRIA_LUA_DIR}/LuaContext.cpp
										${FELOWRIA_LUA_DIR}/LuaFunc.cpp
										${FELOWRIA_LUA_DIR}/LuaVM.cpp

										${FELOWRIA_DIR}/Felowria.cpp)

if(${UNIX})
target_link_libraries(${LIBFELOWRIA}			${LIBRARY_REAL_OUTPUT_PATH}/libLua.a
												-pthread)
else(${UNIX})
target_link_libraries(${LIBFELOWRIA}			${LIBRARY_REAL_OUTPUT_PATH}/libLua.lib
												ws2_32.lib)
set_target_properties(${LIBFELOWRIA} PROPERTIES COMPILE_DEFINITIONS LIBFELOWRIA)
endif(${UNIX})

add_subdirectory(${FELOWRIA_BASE_DIR})
add_subdirectory(${FELOWRIA_NETWORK_DIR})
add_subdirectory(${FELOWRIA_THREAD_DIR})
add_subdirectory(${FELOWRIA_LOG_DIR})
add_subdirectory(${FELOWRIA_GAME_DIR})
add_subdirectory(${FELOWRIA_LUA_DIR})

